import pymysql


def DB():
    a = {"host": 'dl3.izhaohu.com',
         "port": 3306,
         "user": 'root',
         "password": 'vsi666666',
         "db": 'iot'}
    add_db = []
    db = pymysql.connect(**a)
    cur = db.cursor(pymysql.cursors.DictCursor)
    cur.execute('select * from motion_stats where tag_id="006808" and date in ("2019-05-09","2019-05-10","2019-05-11")')
    a = cur.fetchall()
    for i in a:
        add_db.append(i)

    return add_db


print(DB())